package com.education.api.controller.admin.system;

import com.education.business.service.education.OrgInfoService;
import com.education.common.utils.Result;
import com.education.model.dto.DropDownOpts;
import com.education.model.dto.OrgInfoDto;
import com.education.model.entity.OrgInfoEntity;
import com.education.model.entity.SystemLog;
import com.education.model.vo.EduInstVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 机构管理
 *
 * @author zengjintao
 * @version 1.0
 * @create_at 2020/11/21 18:15
 */
@RequestMapping("/system/org")
@RestController
public class OrgInfoController {

    @Resource
    private OrgInfoService orgInfoService;

    /**
     * 机构列表
     *
     * @return
     */
    @GetMapping("/list")
    @RequiresPermissions("system:org:list")
    public Result option(OrgInfoDto orgInfoDto) {
        List<OrgInfoEntity> restDto = orgInfoService.getList(orgInfoDto);
        return Result.success(restDto);
    }

    /**
     * 添加或修改机构
     *
     * @param
     * @return
     */
    @PostMapping
    @RequiresPermissions("system:org:save")
    public Result saveOrUpdate(@RequestBody EduInstVo vo) {
        orgInfoService.save(vo);
        return Result.success();
    }
}
